﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Microsoft.Phone.Controls;

namespace Omnia.UX
{
    public class UXLinkMenu:Button
    {
        public UXLinkMenu()
        {
            DefaultStyleKey = typeof(UXLinkMenu);
            Click += UXLinkMenu_Click;
        }

        void UXLinkMenu_Click(object sender, RoutedEventArgs e)
        {
            if (Uri != null)
            {
                PhoneApplicationFrame page = (PhoneApplicationFrame)Application.Current.RootVisual;
                page.Navigate(Uri);
            }
        }

        public Uri Uri
        {
            get { return GetValue(UriProperty) as Uri; }
            set { SetValue(UriProperty, value); }
        }

        public static readonly DependencyProperty UriProperty = DependencyProperty.Register(
            "Uri",
            typeof(Uri),
            typeof(UXLinkMenu),
            new PropertyMetadata(null));
    }
}
